<template>
	<view>
		<view style="width: 694.64rpx;background: #FFFFFF;border-radius: 24.15rpx;box-sizing: border-box;margin: 32.6rpx 0 36.83rpx 27.77rpx;padding: 48.32rpx 36.83rpx 47rpx 36.24rpx;">
			<view style="display: flex;justify-content: space-between;" @tap="addl('logo')">
				<view style="font-size: 26.58rpx;color: #383838;font-weight: bold;">课程封面</view>
				<view style="display: flex;">
					<view style="font-size: 25.368rpx;color: #D6D6D6;" >上传课程封面</view>
					<image style="width: 38.65rpx;height: 32.616rpx;margin-left: 18rpx;vertical-align: middle;" :src="img_lo" ></image>
				</view>
			</view>
			
			<view style="height: 2rpx;width: 100%;background: #E0E0E0;margin: 39rpx 0;"></view>
			<view v-if="img_lo != '../../../static/newshouye/tupianwu.png'">
				<view style="width: 170rpx;height: 170rpx;position: relative;">
					<image style="width: 170rpx;height: 170rpx;border-radius: 12rpx;" :src="img_lo" @tap.stop="shan"></image>
					<view style="width: 50rpx;height: 50rpx;position: absolute;top: -25rpx;left: 135rpx;" @tap.stop="shanchu_to">
						<image src="../../../static/newshouye/shanchu_cha.png" style="width: 50rpx;height: 50rpx;"></image>
					</view>
				</view>
				<view style="height: 2rpx;width: 100%;background: #E0E0E0;margin: 39rpx 0;"></view>
			</view>
			<view class="imp_" style="justify-content: space-between;display: flex;height: 26.58rpx;!important">
				<view style="font-size: 26.58rpx;color: #383838;font-weight: bold;">课程标题</view>
				<view >
					<input v-model="inpu"  placeholder="请输入课程标题" style="width: 400rpx;height: 30.36rpx;font-size: 28.36rpx;padding: 0;margin: 0;text-align: right;width: 100%;!important" type="text" @blur="zaichu" disabled/>
				</view>
			</view>
			<view style="height: 2rpx;width: 100%;background: #E0E0E0;margin: 39rpx 0;"></view>
			<view class="imp_" style="justify-content: space-between;display: flex;height: 26.58rpx;">
				<view style="font-size: 26.58rpx;color: #383838;font-weight: bold;">课程标签</view>
				<view >
					<input v-model="inpu_ll_"  placeholder="请输入课程标签" style="width: 400rpx;height: 30.36rpx;font-size: 28.36rpx;padding: 0;margin: 0;text-align: right;!important" type="text" disabled/>
				</view>
			</view>
			<view style="height: 2rpx;width: 100%;background: #E0E0E0;margin: 39rpx 0;"></view>
			<view class="imp_" style="justify-content: space-between;display: flex;height: 26.58rpx;">
				<view style="font-size: 26.58rpx;color: #383838;font-weight: bold;;">课程总节数</view>
				<view >
					<input v-model="inpu_"  placeholder="请输入课程总节数" style="width: 400rpx;height: 30.36rpx;font-size: 28.36rpx;padding: 0;margin: 0;text-align: right;!important" type="number" @blur="bianli_" disabled/>
				</view>
			</view>
			<view style="height: 2rpx;width: 100%;background: #E0E0E0;margin: 39rpx 0;"></view>
			<view class="imp_" style="justify-content: space-between;display: flex;height: 26.58rpx;">
				<view style="font-size: 26.58rpx;color: #383838;font-weight: bold;;">套餐价格</view>
				<view >
					<input v-model="inpu_list"  placeholder="输入课程总价格" style="width: 400rpx;height: 30.36rpx;font-size: 28.36rpx;padding: 0;margin: 0;text-align: right;!important" type="number" />
				</view>
			</view>
			<view style="height: 2rpx;width: 100%;background: #E0E0E0;margin: 39rpx 0;"></view>
			<view class="imp_" style="justify-content: space-between;display: flex;height: 26.58rpx;">
				<view style="font-size: 26.58rpx;color: #383838;font-weight: bold;;">课节单价</view>
				<view >
					<input v-model="inpu_l"  placeholder="请勿高于原单价15%" style="width: 400rpx;height: 30.36rpx;font-size: 28.36rpx;padding: 0;margin: 0;text-align: right;" type="number" @blur="jisuan" @focus="jin_p" disabled />
				</view>
			</view>
			<view style="height: 2rpx;width: 100%;background: #E0E0E0;margin: 39rpx 0;"></view>
			<view class="imp_" style="justify-content: space-between;display: flex;height: 26.58rpx;">
				<view style="font-size: 26.58rpx;color: #383838;font-weight: bold;;">使用期限</view>
				<view >
					<input v-model="inpu_ll_qi"  placeholder="请输入使用期限(月)" style="width: 400rpx;height: 30.36rpx;font-size: 28.36rpx;padding: 0;margin: 0;text-align: right;" type="number" @blur="panduan" disabled/>
					<view >
					</view>
				</view>
			</view>
			<view style="height: 2rpx;width: 100%;background: #E0E0E0;margin: 39rpx 0;"></view>
			<view class="imp_" style="justify-content: space-between;display: flex;height: 26.58rpx;">
				<view style="font-size: 26.58rpx;color: #383838;font-weight: bold;;">课程类型</view>
				<view style="display: flex;align-items: center;">
					<view class="uni-list-cell-db" style="height: 20.36rpx;font-size: 25.36rpx;padding: 0;margin: 0;text-align: right;">
						<picker @change="bindPickerChange" :value="index" :range="array">
							<view class="uni-input">{{xuanze}}</view>
						</picker>
					</view>
					<view>
						<image src="../../../static/newshouye/xiala_.png" style="width: 24.15rpx;height: 16.3rpx;"></image>
					</view>
				</view>
			</view>
		</view>
		<view style="margin-left: 27.77rpx;width: 694.6rpx;min-height: 587.1rpx;background: #FFFFFF;border-radius: 24.15rpx;box-sizing: border-box;padding: 38rpx 28.4rpx;">
			<view style="font-size: 26.58rpx;color: #383838;font-weight: bold;letter-spacing: 1rpx;">课程详情</view>
			<view style="margin-top: 31.4rpx;">
				 <textarea placeholder="请详细描述该课程信息"  placeholder-style="font-size:30.15rpx" style="font-size:30.15rpx;width: 598.42rpx;min-height: 197.5rpx;border: 0.6rpx solid #BFBFBF;border-radius: 12rpx;padding: 20rpx;letter-spacing: 1rpx;" v-model="list" maxlength="1000"/>
			</view>
			<view style="font-size: 26.58rpx;color: #383838;font-weight: bold;letter-spacing: 1rpx;margin-top: 41.6rpx;">
				<text style="font-size: 26.58rpx;color: #383838;">课程相关图片</text>
				<text style="font-size: 21.744rpx;color: #BBBBBB;">（{{text_}}）</text>
			</view>
			<view style="display: flex;margin-top: 39rpx;flex-wrap: wrap;">
				<view v-for="(itme,index) in img_list" :key="index" v-if="img_list.length>0" style="margin-right: 45rpx;width: 170rpx;height: 170rpx;position: relative;margin-bottom: 20rpx;" @tap.stop="cha_kan">
					<image :src="itme" mode="" style="width: 170rpx;height: 170rpx;border-radius: 12rpx;border: #D6D6D6 0.09rpx solid;" ></image>
					<view style="width: 50rpx;height: 50rpx;position: absolute;top: -25rpx;left: 135rpx;" @tap.stop="shanchu(index)">
						<image src="../../../static/newshouye/shanchu_cha.png" style="width: 50rpx;height: 50rpx;"></image>
					</view>
				</view>
				<view  v-if="img_list.length<4" @tap="addl('shuzu')">
					<image src="../../../static/newshouye/tijiaotupian.png" style="width: 170rpx;height: 170rpx;"></image>
				</view>
			</view>
			<view style="font-size: 26.58rpx;color: #383838;font-weight: bold;letter-spacing: 1rpx;margin-top: 30rpx;display: flex;justify-content: space-between;align-items: center;">
				<view>参加活动</view>
				<view>
					<text style="margin-right: 18rpx;color: #BEBEBE;">{{xuan_zhekou}}</text>
					<image src="../../../static/newshouye/qiehuan.png" style="width: 85.76rpx;height: 35rpx;vertical-align: middle;" v-if="num_l_ == 1" @tap="aver_('wei')"></image>
					<image src="../../../static/newshouye/qiehuan2.png" style="width: 85.76rpx;height: 35rpx;vertical-align: middle;" v-if="num_l_ != 1" @tap="aver_('xuan')"></image>
					
				</view>
			</view>
			
			<view style="height: 2rpx;width: 100%;background: #E0E0E0;margin: 30rpx 0;"></view>
			<view v-if="num_l_ != 1">
				<view style="font-size: 26.58rpx;color: #383838;font-weight: bold;letter-spacing: 1rpx;margin-top: 30rpx;display: flex;justify-content: space-between;align-items: center;">
					<view>活动开始时间</view>
					<view class="uni-list-cell-db">
						<picker mode="date" :value="date" :start="startDate" :end="endDate" @change="bindDateChange">
							<view class="uni-input">{{date}}</view>
						</picker>
					</view>
				</view>
				<view style="height: 2rpx;width: 100%;background: #E0E0E0;margin: 30rpx 0;"></view>
				<view style="font-size: 26.58rpx;color: #383838;font-weight: bold;letter-spacing: 1rpx;margin-top: 30rpx;display: flex;justify-content: space-between;align-items: center;">
					<view>活动结束时间</view>
					<view class="uni-list-cell-db">
						<picker mode="date" :value="date_" :start="startDate" :end="endDate" @change="bindDateChange_">
							<view class="uni-input" >{{date_}}</view>
						</picker>
					</view>
				</view>
				<view style="height: 2rpx;width: 100%;background: #E0E0E0;margin: 30rpx 0;"></view>
				<view style="font-size: 26.58rpx;color: #383838;font-weight: bold;letter-spacing: 1rpx;margin-top: 30rpx;display: flex;justify-content: space-between;align-items: center;">
					<view>活动单价（元）</view>
					<view >
						<input v-model="huodong_danjia"  placeholder="请输入活动单价(元)" style="width: 400rpx;height: 30.36rpx;font-size: 28.36rpx;padding: 0;margin: 0;text-align: right;!important" type="number"/>
					</view>
				</view>
				<view style="height: 2rpx;width: 100%;background: #E0E0E0;margin: 30rpx 0;"></view>
			</view>
			<view style="font-size: 26.58rpx;color: #383838;font-weight: bold;letter-spacing: 1rpx;margin-top: 30rpx;display: flex;justify-content: space-between;align-items: center;">
				<view>教学大纲</view>
				<view>
					<text style="margin-right: 18rpx;color: #BEBEBE;">{{xuan}}</text>
					<image src="../../../static/newshouye/qiehuan.png" style="width: 85.76rpx;height: 35rpx;vertical-align: middle;" v-if="num_l == 1" @tap="aver('wei')"></image>
					<image src="../../../static/newshouye/qiehuan2.png" style="width: 85.76rpx;height: 35rpx;vertical-align: middle;" v-if="num_l != 1" @tap="aver('xuan')"></image>
				</view>
			</view>
		</view>
		<view style="padding:10rpx  36.24rpx 10rpx 36.24rpx;box-sizing: border-box;width: 750rpx;background: #FFFFFF;margin-top: 33.21rpx;" v-if="att.length > 0">
		    <view style="height: 2rpx;width: 100%;background: #E0E0E0;margin: 20rpx 0;"></view>
			<view v-for="(itme,index) in att" :key="index">
				<view class="imp_" style="justify-content: space-between;display: flex;height: 30.36rpx;align-items: center;">
					<view style="font-size: 28.58rpx;color: #383838;font-weight: bold;;">{{itme.title}}</view>
					<view >
						<input v-model="itme.con"  placeholder="请输入标题" style="height: 30.36rpx;font-size: 28.36rpx;padding: 0;margin: 0;text-align: right;width: 400rpx;" type="text" @blur="dd(itme.con)" />
					</view>
				</view>
				<view style="height: 2rpx;width: 100%;background: #E0E0E0;margin: 30rpx 0;"></view>
			</view>
		</view>
		<view style="width: 648.7rpx;height: 85.76rpx;line-height: 85.76rpx;background: #EE7B30;text-align: center;color: #FFFFFF;font-size: 32rpx;border-radius: 42.9rpx;margin: 81rpx 0 72rpx 50.736rpx;" @tap="xiugai"  v-if="num_l_ != 1">
			修改完成
		</view>
		<view style="width: 648.7rpx;height: 85.76rpx;line-height: 85.76rpx;background: #EE7B30;text-align: center;color: #FFFFFF;font-size: 32rpx;border-radius: 42.9rpx;margin: 81rpx 0 72rpx 50.736rpx;" @tap="xiugai_" v-if="num_l_ == 1">
			修改完成
		</view>
	</view>
</template>
<script>
	import qiniu from "../../../common/qiniuUploader.js"
	export default {
		data() {
			const currentDate = this.getDate({
				format: true
			})
			return {
				inpu_ll_qi:"",
				img_lo:"../../../static/newshouye/tupianwu.png",
				inpu:"",
				inpu_:"",
				inpu_list:"",
				inpu_l:"",
				array: ['预约', '排课'],
				index:0,
				xuanze:'选择课程类型',
				list:"",
				text_:"此项为选填",
				img_list:[],
				title_url:[],
				att:[],
				num_:1,
				biao:{
					title:"",
					cont:""
				},
				quan_bu:[],
				inpu_ll:"",
				inpu_ll_:"",
				jigou_id:"",
				num_l:1,
				xuan:"否",
				pan_duan_:true,
				xuan_zhekou: "否",
				num_l_: 1,
				date: "",
				date_: "",
				huodong_danjia: "",
				kecheng_id: "",
				mechanism_id: "",
				url_list: [],
				shifou: 1
			}
		},
		onLoad(option) {
			let me = this
			me.data()
			const val = JSON.parse(decodeURIComponent(option.num))
			me.pan_duan_ = false
			me.kecheng_id = val.id
			me.img_lo = val.face_url
			me.img_list = val.introduction_url.split(",")
			me.inpu = val.title
			me.inpu_ll_ = val.label
			me.inpu_ = val.course_num
			me.inpu_list = val.amout
			me.mechanism_id = val.mechanism_id
			if(val.map != null){
				if(val.map.priceList.length > 0){
					me.inpu_l = val.map.priceList[0].price
				}
			}
			me.inpu_ll_qi = val.duration
			me.list = val.introduction_content
			if(val.appointment_type == "appointment"){
				me.xuanze = "预约"
			}else{
				me.xuanze = "排课"
			}
			let pan = val.titile_url.split("#$*")
			me.url_list = pan
			let duibi = me.inpu + "(1)"
			let duibi_ = me.inpu + "01"
			let duibi_l = me.inpu + "1"
			if(pan[0] == duibi || pan[0] == duibi_ || val.titile_url == "" || pan[0] == duibi_l){
				me.xuan = "否"
				me.num_l = 1
			}else{
				me.xuan = "是"
				me.num_l = 2
				let zhuan = []
				pan.forEach((itme,index) => {
					let data = {
						title: "课程标题" + (index + 1),
						con: itme
					}
					zhuan.push(data)
				})
				me.att = zhuan
			}
			const huodong = val.is_attend_activities
			if(val.map != null){
				if(huodong && val.map.activityEntity != null){
					me.xuan_zhekou = "是"
					me.num_l_ = 2
					me.date = val.map.activityEntity.start_time.substring(0,11)
					me.date_ =  val.map.activityEntity.end_time.substring(0,11)
					me.huodong_danjia = val.map.activityEntity.price
				}else{
					me.xuan_zhekou = "否"
					me.num_l_ = 1
				}
			}
			try{
				me.jigou_id = uni.getStorageSync('userif_list').mechanism_id
				me.user_id = uni.getStorageSync('userif_list').user_id
			}catch(e){}
		},
		  computed: {
		        startDate() {
		            return this.getDate('start');
		        },
		        endDate() {
		            return this.getDate('end');
		        }
		    },
		methods:{
			async	xiugai(){
					let me = this
					if(me.shifou == 1){
						me.quan_bu = me.url_list
					}
					if(me.num_l == 2){
						me.att.forEach((itme) => {
							if(itme.con == ""){
								me.quan_bu = []
							}
						})
					}
					let lei = ""
					if(me.xuanze == "预约"){
						lei = "appointment"
					}else if(me.xuanze == "排课"){
						lei = "scheduling"
					}else{
						lei = ""
					}
					if(me.num_l == 1){
						let yi_kuang = []
						let num = 1
						for(let i=0;i<me.inpu_;i++){
							let shu = me.inpu + (num < 10 ? "0" + num : num)
							yi_kuang.push(shu)
							num++
						}
						me.quan_bu = yi_kuang
					}
					let url = me.quan_bu.toString().replace(/,/g,"#$*")
					if(me.huodong_danjia > me.inpu_l){
						uni.showToast({
							title:"请注意活动价"
						})
						me.huodong_danjia = ""
					}
					let qishi = new Date(me.date).getTime() + 24*60*60*1000
					let jieshu = new Date(me.date_).getTime()
					let dang =  new Date(me.date).getTime() 
					let quan = new Date().getTime()
					if(qishi　>　jieshu || jieshu < quan){
						if(qishi　>　jieshu){
							uni.showToast({
								title:"请检查时间顺序",
								icon:"none"
							})
						}else{
							uni.showToast({
								title:"请检查结束时间",
								icon:"none"
							})
						}
					}else{
						if(me.inpu_list != "" && lei != "" && me.inpu_ != "" && me.img_lo != "../../../static/newshouye/tupianwu.png" && me.list != "" && me.inpu_ll_ != "" && me.quan_bu.length == me.inpu_ && me.inpu != "" && me.inpu_ll_qi != "" && me.huodong_danjia != "" ){
							const res = await this.$myRequest({
								url:"/masterSetPrice/updateActivityInfo",
								methed: "post",
								data:{
									is_attend_activities: true,
									id: this.kecheng_id,
									start_time: this.date + " " + "00:00:00",
									end_time: this.date_ + " " + "23:59:59",
									activity_price: this.huodong_danjia,
									mechanism_id: this.mechanism_id,
									amout: this.inpu_list,
									face_url: this.img_lo,
									introduction_content: this.list,
									introduction_url: me.img_list.toString(),
									titile_url: url,
									appointment_type: lei
								},
								header:{
									'content-type' : 'application/json'
								}
							})
							if(res.code == 0){
								uni.reLaunch({
								    url:"/pages/World/myCuriosity/myCuriosity"
								});
							}
						}else{
							uni.showToast({
								title:"请填写完整信息",
								icon:"none"
							})
						}
					}
				},
				async	xiugai_(){
						let me = this
						if(me.shifou == 1){
							me.quan_bu = me.url_list
						}
						if(me.num_l == 2){
							me.att.forEach((itme) => {
								if(itme.con == ""){
									me.quan_bu = []
								}
							})
						}
						let lei = ""
						if(me.xuanze == "预约"){
							lei = "appointment"
						}else if(me.xuanze == "排课"){
							lei = "scheduling"
						}else{
							lei = ""
						}
						if(me.num_l == 1){
							let yi_kuang = []
							let num = 1
							for(let i=0;i<me.inpu_;i++){
								let shu = me.inpu + (num < 10 ? "0" + num : num)
								yi_kuang.push(shu)
								num++
							}
							me.quan_bu = yi_kuang
						}
						let url = me.quan_bu.toString().replace(/,/g,"#$*")
						if(me.inpu_list != "" && lei != "" && me.inpu_ != "" && me.img_lo != "../../../static/newshouye/tupianwu.png" && me.list != "" && me.inpu_ll_ != "" && me.quan_bu.length == me.inpu_ && me.inpu != "" && me.inpu_ll_qi != ""){
							const res = await this.$myRequest({
								url:"/masterSetPrice/updateActivityInfo",
								methed: "post",
								data:{
									is_attend_activities: false,
									id: this.kecheng_id,
									start_time: this.date + " " + "00:00:00",
									end_time: this.date_ + " " + "23:59:59",
									activity_price: this.huodong_danjia,
									mechanism_id: this.mechanism_id,
									amout: this.inpu_list,
									face_url: this.img_lo,
									introduction_content: this.list,
									introduction_url: me.img_list.toString(),
									titile_url: url,
									appointment_type: lei
								},
								header:{
									'content-type' : 'application/json'
								}
							})
							if(res.code == 0){
								uni.reLaunch({
								    url:"/pages/World/myCuriosity/myCuriosity"
								});
							}
						}else{
							uni.showToast({
								title:"请填写完整信息",
								icon:"none"
							})
						}
						
					},
			data(){
				const data = new Date().getTime()
				const da = new Date(data)
				const year = da.getFullYear()
				const yue = da.getMonth() + 1 < 10 ? "0" + (da.getMonth() + 1) : da.getMonth() + 1
				const ri = da.getDate() <10 ? "0" + da.getDate() : da.getDate()
				this.date = year + "-" + yue + "-" + ri
				this.date_ = year + "-" + yue + "-" + ri
			},
			bindDateChange_: function(e) {
				this.date_ = e.target.value
			},
			 bindDateChange: function(e) {
				this.date = e.target.value
			},
			getDate(type) {
				const date = new Date();
				let year = date.getFullYear();
				let month = date.getMonth() + 1;
				let day = date.getDate();
				if (type === 'start') {
					year = year - 60;
				} else if (type === 'end') {
					year = year + 2;
				}
				month = month > 9 ? month : '0' + month;;
				day = day > 9 ? day : '0' + day;
				return `${year}-${month}-${day}`;
			},
			aver_(itme){
				if(itme == 'wei'){
					this.num_l_ = 2
					this.xuan_zhekou = "是"
				}else{
					this.num_l_ = 1
					this.xuan_zhekou = "否"
				}
				this.data()
			},
			cha_kan(){
				let me = this
				 uni.previewImage({
					  urls: me.img_list,
					  indicator: "number"
				 })
			},
			shanchu_to(){
				this.img_lo = "../../../static/newshouye/tupianwu.png"
			},
			shanchu(index){
				this.img_list.splice(index,1)
			},
			zaichu(){
				this.quan_bu = []
				this.xuan = "否"
				this.num_l = 1
				this.att = []
			},
			chu(){
				let me = this
				if(me.inpu_list != "" && me.inpu_ != ""){
					me.pan_duan_ = false
				}else{
					me.pan_duan_ = true
				}
				me.inpu_l = ""
			},
			jisuan(){
				let me = this
				let pin = me.inpu_list / me.inpu_
				let jia = Math.ceil(pin.toFixed(0)*1.15)
				let shu = parseInt(me.inpu_l)
				if(shu > jia){
					uni.showToast({
						title:"不高于" + jia + "元每节",
						icon:"none"
					})
					me.inpu_l = ""
				}
			},
			aver(type){
				let me = this
				me.att = []
				me.quan_bu = []
				let d = []
				let dd = []
				me.num_ = 1
				if(type == 'wei'){
					me.num_l = 2
					me.xuan = "是"
					for(let i=0;i<me.inpu_;i++){
						me.data = {
							title:"课程" + me.num_,
							con:""
						}
						d.push(me.data)
						me.num_++
					}
				}else{
					me.num_l = 1
					me.xuan = "否"
					for(let i=0;i<me.inpu_;i++){
						let a = me.inpu + me.num_
						dd.push(a)
						me.num_++
					}
				}
				me.att = d
				me.quan_bu = dd
			},
			panduan(){
				let me = this
				let a = parseInt(me.inpu_ll_qi)
				if(!a){
					uni.showToast({
						title:"请填写数字",
						icon:"none"
					})
					me.inpu_ll_qi = ""
				}
			},
			jinru(){
				let me = this
				me.quan_bu = []
			},
			dd(itme){
				let me = this
				me.shifou = 2
				me.quan_bu.push(itme)
				me.quan_bu.forEach((itme,index) => {
					if(!itme){
						me.quan_bu.splice(index,1)
					}
				})
			},
			dianji(itme,index){
				this.num = index
			},
			bindPickerChange: function(e) {
				this.xuanze = this.array[e.target.value]
			},
			bianli_(){
				let me = this
				if(me.inpu_list != "" && me.inpu_ != ""){
					me.pan_duan_ = false
				}else{
					me.pan_duan_ = true
				}
				me.quan_bu = []
				me.att = []
				me.num_l = 1
				let d = []
				let dd = []
				me.num_ = 1
				for(let i=0;i<me.inpu_;i++){
					let a =  me.inpu + "(" + me.num_ + ")"
					dd.push(a)
					me.num_++
				}
				me.quan_bu = dd
			},
			to(){
				this.key = Math.ceil(Math.random()*1000000)
				uni.request({
					url:"https://www.curiousmore.com/qmore/push/upload/getToken",
					data:{
						key:this.key
					},
					method:"post",
					success:(res) => {
						this.token = res.data.data
					}
				})
			},
			addl(type){
				let me = this
				uni.showActionSheet({
				  itemList: ['从手机相册选择', '拍照'],
				  success: function(res) {
					let aa = []
					if(res.tapIndex == 1){
						aa = ["camera"]
					}else{
						aa = ["album"]
					}
					me.to()
					uni.chooseImage({
						count: 1,
						sizeType: ['compressed'],
						sourceType: aa,
						success:(res_) => {
							let filePath = res_.tempFilePaths[0]
							if(me.token != ""){
								qiniu.upload(filePath, (res) => {
									if(type == "logo"){
										me.img_lo = res.fileUrl
									}else if(type == "shuzu"){
										me.img_list.push(res.fileUrl)
									}
								}, (error) => {
									console.log('error: ' + error);
								}, {
									region: 'ECN',
									domain: 'http://img.curiousmore.com', 
									key: me.key, 
									uptoken: me.token, 
								}, (res) => {
									
								}, () => {
									// 取消上传
								}, () => {
									// `before` 上传前执行的操作
								}, (err) => {
									// `complete` 上传接受后执行的操作(无论成功还是失败都执行)
								});
							}
						}
					})
				  },
				fail: function(res) {
				    console.log(res.errMsg)
				  }
				})
			},
			shan(){
				let val = []
				let me = this
				val.push(me.img_lo)
				uni.previewImage({
					urls: val,
					indicator: "number"
				})
			}
		},
		
		onShow() {
			
		}
	}
</script>
<style lang="scss" scoped>
	.imp_{
		display: flex;
		align-items: center;
	}
	.clc{
		background: #FF7300;
		color: #FFFFFF;
	}
	.cli_{
		color: #FF7300;
	}
	.uni-input{
		width: 400rpx;
		text-align: right;
	}
</style>
